package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysTrainMapper;
import com.ruoyi.system.domain.SysTrain;
import com.ruoyi.system.service.ISysTrainService;
import com.ruoyi.common.core.text.Convert;

/**
 * 实训记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-12-27
 */
@Service
public class SysTrainServiceImpl implements ISysTrainService 
{
    @Autowired
    private SysTrainMapper sysTrainMapper;

    /**
     * 查询实训记录
     * 
     * @param trainId 实训记录主键
     * @return 实训记录
     */
    @Override
    public SysTrain selectSysTrainByTrainId(Long trainId)
    {
        return sysTrainMapper.selectSysTrainByTrainId(trainId);
    }

    /**
     * 查询实训记录列表
     * 
     * @param sysTrain 实训记录
     * @return 实训记录
     */
//    @DataScope(deptAlias = "s", userAlias = "u")
    @Override
    public List<SysTrain> selectSysTrainList(SysTrain sysTrain)
    {
        return sysTrainMapper.selectSysTrainList(sysTrain);
    }

    @Override
    public int selectMoneySum()
    {
        return sysTrainMapper.selectMoneySum();
    }
    /**
     * 新增实训记录
     * 
     * @param sysTrain 实训记录
     * @return 结果
     */
    @Override
    public int insertSysTrain(SysTrain sysTrain)
    {
        sysTrain.setCreateTime(DateUtils.getNowDate());
        return sysTrainMapper.insertSysTrain(sysTrain);
    }

    /**
     * 修改实训记录
     * 
     * @param sysTrain 实训记录
     * @return 结果
     */
    @Override
    public int updateSysTrain(SysTrain sysTrain)
    {
        sysTrain.setUpdateTime(DateUtils.getNowDate());
        return sysTrainMapper.updateSysTrain(sysTrain);
    }

    /**
     * 批量删除实训记录
     * 
     * @param trainIds 需要删除的实训记录主键
     * @return 结果
     */
    @Override
    public int deleteSysTrainByTrainIds(String trainIds)
    {
        return sysTrainMapper.deleteSysTrainByTrainIds(Convert.toStrArray(trainIds));
    }

    /**
     * 删除实训记录信息
     * 
     * @param trainId 实训记录主键
     * @return 结果
     */
    @Override
    public int deleteSysTrainByTrainId(Long trainId)
    {
        return sysTrainMapper.deleteSysTrainByTrainId(trainId);
    }
}
